package web.user.action;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ResultPath;
import org.springframework.beans.factory.annotation.Autowired;
import services.user.UserServices;

@ResultPath(value="/")
@Namespace(value = "/")
public class UserController extends ActionSupport {

    private UserServices userServices;
    @Autowired
    public UserController(UserServices userServices){
        this.userServices = userServices;
    }

    private String username;

    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Action(value="Welcome", results={
            @Result(name="success",location="/welcome.tiles", type="tiles"),
    })
    public String welcome() {
        return SUCCESS;
    }

    @Action(value="login", results={
            @Result(name="success",location="WEB-INF/jsp/User/login.jsp")
    })
    public String login(){
        return SUCCESS;
    }
}
